{
语法百题 解题报告：
 http://git.oschina.net/et0662/sznoi-grammar/ 
}
var
	n:longint;
begin
	readln(n);
	writeln(3*n*(n+1)div 2+n+1  );
end.
